package view;

import java.awt.Color;
import java.awt.Graphics;
import java.util.HashMap;

import javax.swing.JPanel;

import model.SVG;
import model.Shape;

import apps.AppReg;

public class SVGPanel extends JPanel {

    private static final long serialVersionUID = -5557315281267407021L;
    private float zoom_scale = 1;

    public void setZoomScale(float zoom_scale) {
	this.zoom_scale = zoom_scale;
    }

    public SVGPanel() {
	super();
    }

    protected void paintComponent(Graphics g) {
	super.paintComponents(g);

	SVG svg = AppReg.getModel();

	setBackground(Color.WHITE);

	// Get the shapes
	HashMap<Integer, Shape> shapes = svg.getShapes();

	// Iterate through them
	for (Shape shape : shapes.values())
	    shape.draw(g, zoom_scale);

    }

}
